	  <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>public/skin/back-end/css/pde.css" rel="stylesheet" />     	
      <link href="<?php echo base_url();?>public/skin/back-end/js/uploadify/uploadify.css" type="text/css" rel="stylesheet" />
      <script type="text/javascript" src="<?php echo base_url();?>public/skin/back-end/js/uploadify/swfobject.js"></script>
      <script type="text/javascript" src="<?php echo base_url();?>public/skin/back-end/js/uploadify/jquery.uploadify.v2.1.4.js.php?langList=<?php echo base64_encode(serialize($langList));?>"></script>
      <script type="text/javascript">
      var cur_folder = 0;
      var folder_id = '<?php echo $folder_id;?>';
      function ajaxPicture2Folder(picture_id, action) {
        if(folder_id>0)  
	  		$.ajax({		
	  			url: '<?php echo base_url().'admin/gallery_management/picture_to_folder';?>',
	  			type: "POST",
	  			data: ({ picture_id : picture_id, folder_id:folder_id, action:action}), 
	  			dataType: "json"
	  		});
        else return false;
  		}
      $(document).ready(function() {          
    	  ajaxListImages(0,0);
        $('#file_upload').uploadify({
          'uploader'  : '<?php echo base_url();?>public/skin/back-end/js/uploadify/uploadify.swf',
          'script'    : '<?php echo base_url();?>admin/gallery_management/uploadify',
          'cancelImg' : '<?php echo base_url();?>public/skin/back-end/js/uploadify/cancel.png',
          'folder'    : '/public/upload/',
          'auto'      : false,
          'scriptData': {'PHPSESSID':'<?php echo $session_id;?>'},
		  'removeCompleted' : true,
		  'multi'     : true,
		  'fileExt'   : '*.jpg;*.gif;*.png',
		  'fileDesc'  : 'Image Files',
		  'method'	  : 'post',
		  'onSelect'    : function(event,ID,fileObj) {
		        $('.submitButton').show();
		  }, 
		  'onComplete'  : function(event, ID, fileObj, response, data) {
			  $.ajax({
				  url: "<?php echo base_url();?>admin/gallery_management/add_picture/",
				  type: "POST",
				  data: ({url:response,description:$('#description_'+ID).val(),language:$('#language_'+ID).val(),folder_id:cur_folder}),
				  dataType: 'json',
				  success: function(data) {
					  ajaxListImages(0,cur_folder);
				  }
				});	
		  },
		  'onCancel'    : function(event,ID,fileObj,data) {
			  $('.submitButton').hide();
		  },
		  'onAllComplete' : function(event,data) {
			  $('.submitButton').hide();
		  }
        });
      });
      function ajaxListImages(perpage,fid){
    	  cur_folder = fid;
    	  $.ajax({
			  url: "<?php echo base_url();?>admin/gallery_management/picture_list/"+fid,
			  type: "GET",
			  success: function(data) {
				    $('.listimage').html(data);
				  },

			  data: ({per_page: perpage,folder_id: folder_id}),
			  dataType: 'html'
			});	
      }
      function deleteImages(image_id){
    		$.prompt('You are deleting this image. Would you like to continue?',{
    			submit:function(v,m) {
    				if(v == true){
    					$.ajax({		
    						url: "<?php echo base_url();?>admin/gallery_management/delete_picture",
    						type: "POST",
    						data: ({ id : image_id }),
    						dataType: "json",
    	                    
    						success: function(data, textStatus, jqXHR){
    	                        
    	                        jQuery.prompt.close();
    	                        if(data.success == true){
    	                        	ajaxListImages(0,cur_folder);
    	                        	$.prompt('Deleted successfully!',{ buttons: { Ok: true}, zIndex : 1000000000 });
    	                        }	
    	                        else{
    	                        	$.prompt('Can not delete.',{ buttons: { Ok: true}, zIndex : 1000000000 });
    	                        }
    						}
    					});
    				}
    				return true;
    			},
    			buttons: { Ok:true, Cancel: false },
    	        zIndex : 1000000000
    		});
    		
    	}
      function thickBoxPopup(id,start,fid){
    		tb_show('Edit image','<?php echo base_url();?>admin/gallery_management/edit_picture.html?fid='+fid+'&id='+id+'&start='+start+'&width=350&height=370');
      }	  	
      </script>
<div class="folder_container">
	<div class="box">
	<h1>Folder</h1>
	<ul class="pde">
	<li>
		<a rel="58" href="#" onclick="ajaxListImages(0,0);$('.curfolder').removeClass('curfolder');$(this).addClass('curfolder');" class="curfolder"><img src="<?php echo base_url()?>public/skin/back-end/images/folder.png">All Images</a>
	</li>
	<?php 
	foreach($list_folder as $row){
	?>
	<li>
		<a rel="58" href="#" onclick="ajaxListImages(0,<?php echo $row['id'];?>);$('.curfolder').removeClass('curfolder');$(this).addClass('curfolder');"><img src="<?php echo base_url()?>public/skin/back-end/images/folder.png"><?php echo $row['folder_name']; ?></a>
		<?php if(!empty($callback)){?>
		<span style="float:right;padding-right:10px;"><img style="cursor:pointer" onclick="$('<?php echo '#'.$callback.'_text';?>').val('<?php echo $row['folder_name']?>');$('<?php echo '#'.$callback;?>').val('<?php echo $row['id']?>');parent.tb_remove();" src="<?php echo base_url();?>public/skin/back-end/images/icon_check.png" /></span>
		<?php }?>
	</li>
	<?php 	
	}
	?>
	</ul>
	</div>
</div>
<div class="picture_container">      
	<div class="upload_container">
	<input type="file" id="file_upload" name="file_upload" />
	<div class="submitButton" style="display:none">
		<button onclick="$('#file_upload').uploadifyUpload();" type="button">Upload Files</button>
	</div>
	</div>
	<div class="listimage">
	</div>
</div>
<div style="clear:both;">&nbsp;</div>